package com.amap.search.entity.es;

import cn.hutool.core.util.NumberUtil;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.DateFormat;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import java.math.BigDecimal;
import java.util.Date;

@Data
@NoArgsConstructor
@AllArgsConstructor
@ToString
@Document(indexName = "poi_record", shards = 3, replicas = 2)
public class PoiRecordEs {

    /**
     * id唯一标识
     */
    @Id
    private Long id;

    @Field(type = FieldType.Keyword)
    private String poiId;

    @Field(type = FieldType.Text, analyzer = "ik_max_word")
    private String name;

    @Field(type = FieldType.Text, analyzer = "ik_smart")
    private String type;

    @Field(type = FieldType.Keyword)
    private String typeCode;

    @Field(type = FieldType.Keyword)
    private String addressCode;

    @Field(type = FieldType.Text, analyzer = "ik_max_word")
    private String address;

    @Field(type = FieldType.Text, analyzer = "ik_smart")
    private String tag;

    // 纬度
    @Field(type = FieldType.Double)
    private Double latitude;

    // 经度
    @Field(type = FieldType.Double)
    private Double longitude;

    @Field(type = FieldType.Keyword, index = false)
    private String tel;

    @Field(type = FieldType.Float)
    private BigDecimal rating;

    @Field(type = FieldType.Float)
    private BigDecimal cost;

    @Field(type = FieldType.Keyword, index = false)
    private String photos;

    @Field(type = FieldType.Date, format = DateFormat.date_hour_minute_second, pattern = "yyyy-MM-dd HH:mm:ss")
    private Date updateDate;

    @Field(type = FieldType.Date, format = DateFormat.date_hour_minute_second, pattern = "yyyy-MM-dd HH:mm:ss")
    private Date recordDate;

    // 省名
    @Field(type = FieldType.Keyword)
    private String provinceName;

    // 城市名
    @Field(type = FieldType.Keyword)
    private String cityName;

    // 区名
    @Field(type = FieldType.Keyword)
    private String adName;

}
